﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;

using XCode;
using BingZi.HY.Core;

namespace BingZi.HY.Core
{
	/// <summary>
	/// 角色表
	/// </summary>
	[Serializable]
	[DataObject]
	[Description("角色表")]
	[BindTable("sys_Roles", Description = "角色表", ConnName = "System")]
	public partial class sys_Roles
	{
		#region 属性
		private Int32 _RoleID;
		/// <summary>
		/// 角色ID自动ID
		/// </summary>
		[Description("角色ID自动ID")]
		[DataObjectField(true, true, false, 10)]
		[BindColumn(1, "RoleID", "角色ID自动ID", "", "int", 10, 0, false)]
		public Int32 RoleID
		{
			get { return _RoleID; }
			set { if (OnPropertyChanging("RoleID", value)) { _RoleID = value;   } }
		}

		private Int32 _R_UserID;
		/// <summary>
		/// 角角所属用户ID
		/// </summary>
		[Description("角角所属用户ID")]
		[DataObjectField(false, false, false, 10)]
		[BindColumn(2, "R_UserID", "角角所属用户ID", "", "int", 10, 0, false)]
		public Int32 R_UserID
		{
			get { return _R_UserID; }
			set { if (OnPropertyChanging("R_UserID", value)) { _R_UserID = value;   } }
		}

		private String _R_RoleName;
		/// <summary>
		/// 角色名称
		/// </summary>
		[Description("角色名称")]
		[DataObjectField(false, false, false, 50)]
		[BindColumn(3, "R_RoleName", "角色名称", "", "nvarchar(50)", 0, 0, true)]
		public String R_RoleName
		{
			get { return _R_RoleName; }
			set { if (OnPropertyChanging("R_RoleName", value)) { _R_RoleName = value;   } }
		}

		private String _R_Description;
		/// <summary>
		/// 角色介绍
		/// </summary>
		[Description("角色介绍")]
		[DataObjectField(false, false, true, 255)]
		[BindColumn(4, "R_Description", "角色介绍", "", "nvarchar(255)", 0, 0, true)]
		public String R_Description
		{
			get { return _R_Description; }
			set { if (OnPropertyChanging("R_Description", value)) { _R_Description = value;   } }
		}
		#endregion

		#region 获取/设置 字段值
		/// <summary>
		/// 获取/设置 字段值。
		/// 一个索引，基类使用反射实现。
		/// 派生实体类可重写该索引，以避免反射带来的性能损耗
		/// </summary>
		/// <param name="name">字段名</param>
		/// <returns></returns>
		public override Object this[String name]
		{
			get
			{
				switch (name)
				{
					case "RoleID" : return _RoleID;
					case "R_UserID" : return _R_UserID;
					case "R_RoleName" : return _R_RoleName;
					case "R_Description" : return _R_Description;
					default: return base[name];
				}
			}
			set
			{
				switch (name)
				{
					case "RoleID" : _RoleID = Convert.ToInt32(value); break;
					case "R_UserID" : _R_UserID = Convert.ToInt32(value); break;
					case "R_RoleName" : _R_RoleName = Convert.ToString(value); break;
					case "R_Description" : _R_Description = Convert.ToString(value); break;
					default: base[name] = value; break;
				}
			}
		}
		#endregion

		#region 字段名
		/// <summary>
		/// 取得角色表字段名的快捷方式
		/// </summary>
        [CLSCompliant(false)]
		public class _
		{
			///<summary>
			/// 角色ID自动ID
			///</summary>
			public const String RoleID = "RoleID";

			///<summary>
			/// 角角所属用户ID
			///</summary>
			public const String R_UserID = "R_UserID";

			///<summary>
			/// 角色名称
			///</summary>
			public const String R_RoleName = "R_RoleName";

			///<summary>
			/// 角色介绍
			///</summary>
			public const String R_Description = "R_Description";
		}
		#endregion
	}
}